<template>
  <view>
    <cu-custom bgColor="bg-gradual-green" :isBack="true">
      <block slot="backText">返回</block>
      <block slot="content">添加身体测试</block>
    </cu-custom>

    <view style="width: 100%;">
      <view style="width: 100%;height: 100upx;line-height: 100upx;display: flex;padding: 0 30upx;background-color: #fff;justify-content: space-between;">
        <view>
          基本信息
        </view>
        <view>
          <picker mode="date" :value="date" :start="startDate" :end="endDate" @change="bindDateChange">
            <view style="display: flex;font-size: 22upx;">
              <view style="width: 20upx;height: 20upx;background-color: #1CBBB4;border-radius: 20upx;margin-top: 40upx;"></view>
              <view style="margin-top: 3upx;">
                体测日期
              </view>
              <input style="height: 100upx;line-height: 100upx;text-align: right;width: 150upx;" type="number" disabled
                :value="date" />
            </view>
          </picker>
        </view>
      </view>
      <view style="width: 100%;height: 100upx;line-height: 100upx;display: flex;padding: 0 30upx;background-color: #fff;justify-content: space-between;">
        <view style="display: flex;">
          <view style="width: 100upx;height: 100upx;line-height: 100upx;border-radius: 100upx;background-color: #1CBBB4;color: #fff;text-align: center;">
            {{user.nickName || user.username}}
          </view>
          <view style="margin: 0 40upx;font-size: 22upx;display: flex;">
            {{user.nickName || user.username}}
            <view style="background-color: #666;height: 30upx;width: 1upx;margin: 0 20upx;margin-top: 35upx;"></view>
            <view v-if="sex==1">
              男
            </view>
            <view v-if="sex==2">
              女
            </view>
          </view>
        </view>
        <view @click="back" style="background-color: #F6F6F6;color: #9A9A9A;width: 200upx;height: 70upx;line-height: 70upx;text-align: center;border-radius: 35upx;margin-top: 15upx;">
          切换客户
        </view>
      </view>
      <view style="width: 100%;height: 100upx;line-height: 100upx;display: flex;padding: 0 30upx;background-color: #fff;justify-content: space-between;">
        <view style="display: flex;">
          <view>
            年龄
          </view>
          <view>
            <input type="digit" v-model="age" style="border-bottom: 1upx solid #919191;width: 100upx;margin-top: 30upx;text-align: center;" />
          </view>
          <view style="color: #919191;">
            岁
          </view>
        </view>
        <view style="display: flex;">
          <view>
            身高
          </view>
          <view>
            <input type="digit" v-model="height" style="border-bottom: 1upx solid #919191;width: 100upx;margin-top: 30upx;text-align: center;" />
          </view>
          <view style="color: #919191;">
            cm
          </view>
        </view>
        <view style="display: flex;">
          <view>
            体重
          </view>
          <view>
            <input type="digit" v-model="weight" style="border-bottom: 1upx solid #919191;width: 100upx;margin-top: 30upx;text-align: center;" />
          </view>
          <view style="color: #919191;">
            kg
          </view>
        </view>
      </view>
    </view>
    <view style="width: 100%;height: 100upx;line-height: 100upx;display: flex;padding: 0 30upx;">
      <view class="st_class" v-for="(item,index) in menus" :key='index' :class="{active: currentIndex === index}"
        @click="menusClick(index)">
        {{item}}
      </view>
    </view>

    <view v-if="currentIndex==0">
      <view style="background-color: #fff;padding: 30upx;">
        <view style="display: flex;border: 1upx dashed #919191;padding: 30upx;justify-content: space-around;">
          <view style="text-align: center;" @click="scanCode">
            <image style="width: 100upx;height: 100upx;" src="../../static/saoyisao.png" mode=""></image>
            <view class="">
              扫一扫
            </view>
            <view style="color: #919191;font-size: 22upx;">
              扫码读取体测数据
            </view>
          </view>
          <view style="text-align: center;" @click="chooseImage">
            <image style="width: 100upx;height: 100upx;" :src="ticebaogao||'../../static/paizhao.png'" mode=""></image>
            <view class="">
              拍照
            </view>
            <view style="color: #919191;font-size: 22upx;">
              拍照上传体测报告
            </view>
          </view>
        </view>
        <view style="display: flex;width: 100%;padding: 0 4%;justify-content: space-between;height: 100upx;line-height: 100upx;border-bottom: 1upx solid #F0F0F0;background-color: #fff;">
          <view class="">
            BMI
          </view>
          <view style="display: flex;">
            <input style="height: 100upx;line-height: 100upx;width: 180upx;text-align: right;" type="digit" v-model="bmi" />
            <view style="color: #919191;margin-left: 20upx;">

            </view>
          </view>
        </view>
        <view style="display: flex;width: 100%;padding: 0 4%;justify-content: space-between;height: 100upx;line-height: 100upx;border-bottom: 1upx solid #F0F0F0;background-color: #fff;">
          <view class="">
            体脂率
          </view>
          <view style="display: flex;">
            <input style="height: 100upx;line-height: 100upx;width: 180upx;text-align: right;" type="digit" v-model="vfdata" />
            <view style="color: #919191;margin-left: 20upx;">
              %
            </view>
          </view>
        </view>
        <view style="display: flex;width: 100%;padding: 0 4%;justify-content: space-between;height: 100upx;line-height: 100upx;border-bottom: 1upx solid #F0F0F0;background-color: #fff;">
          <view class="">
            脂肪量
          </view>
          <view style="display: flex;">
            <input style="height: 100upx;line-height: 100upx;width: 180upx;text-align: right;" type="digit" v-model="bfr" />
            <view style="color: #919191;margin-left: 20upx;">
              kg
            </view>
          </view>
        </view>

        <view style="display: flex;width: 100%;padding: 0 4%;justify-content: space-between;height: 100upx;line-height: 100upx;border-bottom: 1upx solid #F0F0F0;background-color: #fff;">
          <view class="">
            水分
          </view>
          <view style="display: flex;">
            <input style="height: 100upx;line-height: 100upx;width: 180upx;text-align: right;" type="digit" v-model="bwr" />
            <view style="color: #919191;margin-left: 20upx;">
              kg
            </view>
          </view>
        </view>
        <view style="display: flex;width: 100%;padding: 0 4%;justify-content: space-between;height: 100upx;line-height: 100upx;border-bottom: 1upx solid #F0F0F0;background-color: #fff;">
          <view class="">
            骨骼肌
          </view>
          <view style="display: flex;">
            <input style="height: 100upx;line-height: 100upx;width: 180upx;text-align: right;" type="digit" v-model="skm" />
            <view style="color: #919191;margin-left: 20upx;">
              kg
            </view>
          </view>
        </view>
        <view style="display: flex;width: 100%;padding: 0 4%;justify-content: space-between;height: 100upx;line-height: 100upx;border-bottom: 1upx solid #F0F0F0;background-color: #fff;">
          <view class="">
            骨骼量
          </view>
          <view style="display: flex;">
            <input style="height: 100upx;line-height: 100upx;width: 180upx;text-align: right;" type="digit" v-model="bbm" />
            <view style="color: #919191;margin-left: 20upx;">
              kg
            </view>
          </view>
        </view>
        <!-- <view style="display: flex;width: 100%;padding: 0 4%;justify-content: space-between;height: 100upx;line-height: 100upx;border-bottom: 1upx solid #F0F0F0;background-color: #fff;">
          <view class="">
            肌肉量
          </view>
          <view style="display: flex;">
            <input style="height: 100upx;line-height: 100upx;width: 180upx;text-align: right;"
              type="digit" value="" />
            <view style="color: #919191;margin-left: 20upx;">
              kg
            </view>
          </view>
        </view> -->
        <view style="display: flex;width: 100%;padding: 0 4%;justify-content: space-between;height: 100upx;line-height: 100upx;border-bottom: 1upx solid #F0F0F0;background-color: #fff;">
          <view class="">
            腰臀比
          </view>
          <view style="display: flex;">
            <input style="height: 100upx;line-height: 100upx;text-align: right;" type="digit" v-model="waistHipRatio"
              placeholder="腰臀比的范围是0~2之间" />
          </view>
        </view>
      </view>
      <view style="width: 100%;height: 80upx;line-height: 80upx; display: flex;padding: 0 30upx;font-size: 22upx;background-color: #F6F6F6;">
        肌肉量=骨骼肌+平滑肌+心肌(请确认您测试的成分类型,再进行填写)
      </view>
      <view @click="xiayibu" style="width: 100%;height: 100upx;line-height: 100upx;background-color: #39BB9E;color: #fff;text-align: center;">
        下一步
      </view>
    </view>


    <view v-if="currentIndex==1">
      <view style="background-color: #fff;padding: 30upx;">
        <view style="display: flex;justify-content: space-between;">
          <view style="text-align: center;" @click="chooseImage1">
            <image style="width: 150upx;height: 150upx;" :src="frontPhoto||'../../static/zm.png'" mode=""></image>
          </view>
          <view style="text-align: center;" @click="chooseImage2">
            <image style="width: 150upx;height: 150upx;" :src="backPhoto||'../../static/bm.png'" mode=""></image>
          </view>
          <view style="text-align: center;" @click="chooseImage3">
            <image style="width: 150upx;height: 150upx;" :src="leftPhoto||'../../static/zcm.png'" mode=""></image>
          </view>
          <view style="text-align: center;" @click="chooseImage4">
            <image style="width: 150upx;height: 150upx;" :src="rightPhoto||'../../static/ycm.png'" mode=""></image>
          </view>
        </view>
        <view style="display: flex;width: 100%;padding: 0 4%;justify-content: space-between;height: 100upx;line-height: 100upx;border-bottom: 1upx solid #F0F0F0;background-color: #fff;">
          <view class="">
            血压
          </view>
          <view style="display: flex;">
            <view>
              收缩压/舒张压
            </view>
            <input style="height: 100upx;line-height: 100upx;width: 200upx;text-align: right;" type="text" v-model="bloodPressure" />
            <view style="color: #919191;margin-left: 20upx;">
              mmHg
            </view>
          </view>
        </view>
        <view style="display: flex;width: 100%;padding: 0 4%;justify-content: space-between;height: 100upx;line-height: 100upx;border-bottom: 1upx solid #F0F0F0;background-color: #fff;">
          <view class="">
            心率
          </view>
          <view style="display: flex;">
            <input style="height: 100upx;line-height: 100upx;width: 180upx;text-align: right;" type="digit" v-model="heartBeat" />
            <view style="color: #919191;margin-left: 20upx;">
              bpm
            </view>
          </view>
        </view>
        <view style="display: flex;width: 100%;padding: 0 4%;justify-content: space-between;height: 100upx;line-height: 100upx;border-bottom: 1upx solid #F0F0F0;background-color: #fff;">
          <view class="">
            胸围
          </view>
          <view style="display: flex;">
            <input style="height: 100upx;line-height: 100upx;width: 180upx;text-align: right;" type="digit" v-model="bust" />
            <view style="color: #919191;margin-left: 20upx;">
              cm
            </view>
          </view>
        </view>
        <view style="display: flex;width: 100%;padding: 0 4%;justify-content: space-between;height: 100upx;line-height: 100upx;border-bottom: 1upx solid #F0F0F0;background-color: #fff;">
          <view class="">
            肩围
          </view>
          <view style="display: flex;">
            <input style="height: 100upx;line-height: 100upx;width: 180upx;text-align: right;" type="digit" v-model="shoulderCir" />
            <view style="color: #919191;margin-left: 20upx;">
              cm
            </view>
          </view>
        </view>
        <view style="display: flex;width: 100%;padding: 0 4%;justify-content: space-between;height: 100upx;line-height: 100upx;border-bottom: 1upx solid #F0F0F0;background-color: #fff;">
          <view class="">
            腰围
          </view>
          <view style="display: flex;">
            <input style="height: 100upx;line-height: 100upx;width: 180upx;text-align: right;" type="digit" v-model="waistCir" />
            <view style="color: #919191;margin-left: 20upx;">
              cm
            </view>
          </view>
        </view>
        <view style="display: flex;width: 100%;padding: 0 4%;justify-content: space-between;height: 100upx;line-height: 100upx;border-bottom: 1upx solid #F0F0F0;background-color: #fff;">
          <view class="">
            臀围
          </view>
          <view style="display: flex;">
            <input style="height: 100upx;line-height: 100upx;width: 180upx;text-align: right;" type="digit" v-model="hipsCir" />
            <view style="color: #919191;margin-left: 20upx;">
              cm
            </view>
          </view>
        </view>
        <view style="display: flex;width: 100%;padding: 0 4%;justify-content: space-between;height: 100upx;line-height: 100upx;border-bottom: 1upx solid #F0F0F0;background-color: #fff;">
          <view class="">
            左上臂围
          </view>
          <view style="display: flex;">
            <input style="height: 100upx;line-height: 100upx;width: 180upx;text-align: right;" type="digit" v-model="leftArm" />
            <view style="color: #919191;margin-left: 20upx;">
              cm
            </view>
          </view>
        </view>
        <view style="display: flex;width: 100%;padding: 0 4%;justify-content: space-between;height: 100upx;line-height: 100upx;border-bottom: 1upx solid #F0F0F0;background-color: #fff;">
          <view class="">
            右上臂围
          </view>
          <view style="display: flex;">
            <input style="height: 100upx;line-height: 100upx;width: 180upx;text-align: right;" type="digit" v-model="rightArm" />
            <view style="color: #919191;margin-left: 20upx;">
              cm
            </view>
          </view>
        </view>
        <view style="display: flex;width: 100%;padding: 0 4%;justify-content: space-between;height: 100upx;line-height: 100upx;border-bottom: 1upx solid #F0F0F0;background-color: #fff;">
          <view class="">
            左大腿围
          </view>
          <view style="display: flex;">
            <input style="height: 100upx;line-height: 100upx;width: 180upx;text-align: right;" type="digit" v-model="leftThigh" />
            <view style="color: #919191;margin-left: 20upx;">
              cm
            </view>
          </view>
        </view>
        <view style="display: flex;width: 100%;padding: 0 4%;justify-content: space-between;height: 100upx;line-height: 100upx;border-bottom: 1upx solid #F0F0F0;background-color: #fff;">
          <view class="">
            右大腿围
          </view>
          <view style="display: flex;">
            <input style="height: 100upx;line-height: 100upx;width: 180upx;text-align: right;" type="digit" v-model="rightThigh" />
            <view style="color: #919191;margin-left: 20upx;">
              cm
            </view>
          </view>
        </view>
        <view style="display: flex;width: 100%;padding: 0 4%;justify-content: space-between;height: 100upx;line-height: 100upx;border-bottom: 1upx solid #F0F0F0;background-color: #fff;">
          <view class="">
            左小腿围
          </view>
          <view style="display: flex;">
            <input style="height: 100upx;line-height: 100upx;width: 180upx;text-align: right;" type="digit" v-model="leftCalf" />
            <view style="color: #919191;margin-left: 20upx;">
              cm
            </view>
          </view>
        </view>
        <view style="display: flex;width: 100%;padding: 0 4%;justify-content: space-between;height: 100upx;line-height: 100upx;border-bottom: 1upx solid #F0F0F0;background-color: #fff;">
          <view class="">
            右小腿围
          </view>
          <view style="display: flex;">
            <input style="height: 100upx;line-height: 100upx;width: 180upx;text-align: right;" type="digit" v-model="rightCalf" />
            <view style="color: #919191;margin-left: 20upx;">
              cm
            </view>
          </view>
        </view>
      </view>
      <view style="width: 100%;height: 80upx;line-height: 80upx; display: flex;padding: 0 30upx;font-size: 22upx;background-color: #F6F6F6;">
        肌肉量=骨骼肌+平滑肌+心肌(请确认您测试的成分类型,再进行填写)
      </view>
      <view @click="submit" style="width: 100%;height: 100upx;line-height: 100upx;background-color: #39BB9E;color: #fff;text-align: center;">
        生成报告
      </view>
    </view>
  </view>
</template>

<script>
  import timeJS from "../../common/time.js"
  export default {
    data() {
      return {
        date: timeJS.gettime.getDate({
          format: true
        }),
        menus: ['身体成分', '身体测量'],
        currentIndex: 0,
        username: '',
        age: '',
        sex: '',
        openid: uni.getStorageSync("openid"),
        userId: '',
        height: '',
        weight: '',
        bId: 1, //
        backPhoto: '',
        bloodPressure: '',
        bust: '',
        frontPhoto: '',
        gymId: '',
        heartBeat: '', // 
        hipsCir: '',
        leftArm: '',
        leftCalf: '',
        leftPhoto: '',
        leftThigh: '',
        rightArm: '',
        rightCalf: '',
        rightPhoto: '',
        rightThigh: '',
        shoulderCir: '',
        waistCir: '',
        ticebaogao: '',
        ticebaogao1: '',
        frontPhoto1: '',
        backPhoto1: '',
        leftPhoto1: '',
        rightPhoto1: '',
        vfdata: "",
        skm: "",
        bmi: "",
        bfr: "",
        bwr: "",
        bbm: "",
        waistHipRatio: "",
        user: {},

        measurementId: '',
      }
    },
    onLoad(e) {
      // 这里不用e 因为 还要从其它地方进来，没有传值
      this.user = uni.getStorageSync("phyUser");
      let even = uni.getStorageSync("phyUser2");
      console.log('查看传进来的', even);
      uni.setStorageSync("userId", even.userId);
      this.userId = even.userId;
      this.username = even.username;
      const date = new Date();
      let year = date.getFullYear();
      console.log('查看年', year);
      this.age = even.age ? year - even.age : ''
      this.sex = even.sex
      let that = this;
      that.getId();

    },
    methods: {
      async submit() {
        var data = {
          'bId': this.bId, // 教练id
          'backPhoto': this.backPhoto1, // 2.背面图片
          'bbm': this.bbm, // 1.骨头重量
          'bfr': this.bfr, // 1.身体脂肪率
          'bloodPressure': this.bloodPressure, // 2.血压 收缩压/舒张压
          'bmi': this.bmi, // 1.体格指数
          'bust': this.bust, // 2 胸围
          'bwr': this.bwr, // 1.水分率
          'frontPhoto': this.frontPhoto1, // 2.正面图片
          'gymId': this.gymId, // 场馆id
          'heartBeat': this.heartBeat, // 2.心率
          'height': this.height, // 身高
          'hipsCir': this.hipsCir, // 2.臀围
          'leftArm': this.leftArm, // 2.左上臂围
          'leftCalf': this.leftCalf, // 2.左小腿围
          'leftPhoto': this.leftPhoto1, // 2.左侧面照片
          'leftThigh': this.leftThigh, // 2.左大腿围
          'mr': "", // 1.基础代谢
          'rightArm': this.rightArm, // 2.右上臂围
          'rightCalf': this.rightCalf, // 2.右小腿围
          'rightPhoto': this.rightPhoto1, // 2.右侧面照片
          'rightThigh': this.rightThigh, // 2.右大腿围
          'shoulderCir': this.shoulderCir, // 2.肩围
          'skm': this.skm, // 1.骨骼肌
          'teachId': this.openid, // 教练Id openid
          'userId': this.userId, // 会员id
          'vfdata': this.vfdata, // 1.内脏脂肪数
          'waistCir': this.waistCir, // 2.腰围
          'waistHipRatio': this.waistHipRatio, // 1.腰臀比
          'weight': this.weight, // 体重
        }
        console.log(data)
        let res = await this.$myRuquest({
          url: "/coach/body/addBodyMeasurement",
          method: 'POST',
          data,
          header: {
            "Content-Type": "application/json"
          },
        })

        console.log('查看提交数据', res)
        uni.navigateTo({
          url: '/pagesA/Physical_test/Test_report',
        });
      },

      async getId() {
        let {
          data: {
            datas
          }
        } = await this.$myRuquest({
          url: "/coach/body/getBodyMeasurementList",
          data: {
            userId: uni.getStorageSync("phyUser").userId,
          }
        })
        console.log('查看数据', datas)
        if (datas.length) {
          this.measurementId = datas[0].id
          this.setajax();
        }
      },

      async setajax() {
        let {
          data: {
            datas
          }
        } = await this.$myRuquest({
          url: '/coach/body/getBodyMeasurement',
          data: {
            measurementId: this.measurementId,
          },
        })
        if (datas) {
          this.bbm = datas.bbm // 1.骨头重量
          this.bfr = datas.bfr // 1.身体脂肪率
          this.bloodPressure = datas.bloodPressure // 2.血压 收缩压/舒张压
          this.bmi = datas.bmi // 1.体格指数
          this.bust = datas.bust // 2 胸围
          this.bwr = datas.bwr // 1.水分率
          this.gymId = datas.gymId // 场馆id
          this.heartBeat = datas.heartBeat // 2.心率
          this.height = datas.height // 身高
          this.hipsCir = datas.hipsCir // 2.臀围
          this.leftArm = datas.leftArm // 2.左上臂围
          this.leftCalf = datas.leftCalf // 2.左小腿围
          this.leftThigh = datas.leftThigh // 2.左大腿围
          this.rightArm = datas.rightArm // 2.右上臂围
          this.rightCalf = datas.rightCalf // 2.右小腿围
          this.rightThigh = datas.rightThigh // 2.右大腿围
          this.shoulderCir = datas.shoulderCir // 2.肩围
          this.skm = datas.skm // 1.骨骼肌
          this.vfdata = datas.vfdata // 1.内脏脂肪数
          this.waistCir = datas.waistCir // 2.腰围
          this.waistHipRatio = datas.waistHipRatio // 1.腰臀比
          this.weight = datas.weight // 体重
        }
      },
      async getMemberBodyTestData() {
        let {
          data: {
            datas
          }
        } = await this.$myRuquest({
          url: '/coach/body/getMemberBodyTestData',
          data: {
            userId: uni.getStorageSync("phyUser").userId,
            testDate: this.date,
          },
        })
        console.log('查看扫一扫获取的数据', datas)
        this.bbm = datas.bbm // 1.骨头重量
        this.bfr = datas.bfr // 1.身体脂肪率
        this.bmi = datas.bmi // 1.体格指数
        this.bwr = datas.bwr // 1.水分率
        this.height = datas.height // 身高
        this.skm = datas.skm // 1.骨骼肌
        this.vfdata = datas.vfdata // 1.内脏脂肪数
        this.weight = datas.weight // 体重
      },
      scanCode() {
        uni.scanCode({
          onlyFromCamera: true,
          success: function(res) {
            console.log('条码类型：' + res.scanType);
            console.log('条码内容：' + res.result);
            this.getMemberBodyTestData();
          }
        });
      },
      chooseImage() {
        var _this = this
        uni.chooseImage({
          count: 1, //默认9
          sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
          sourceType: ['camera'], //从相册选择
          success: function(res) {
            let file = res.tempFilePaths
            var images = []
            var img = ''
            console.log(res.tempFilePaths[0])
            _this.ticebaogao = res.tempFilePaths[0]
            for (var i = 0; i < res.tempFilePaths.length; i++) {
              uni.uploadFile({
                url: 'https://jxjsservice.jxfit.cn/coach/baseService/uploadFile',
                //仅为示例，非真实的接口地址
                filePath: file[i],
                name: 'file',
                formData: {
                  'user': 'test'
                },
                success: (res) => {
                  console.log(res)
                  console.log(JSON.parse(res.data))
                  images.push(JSON.parse(res.data).datas.face)
                  _this.imagess = images
                  // console.log(_this.imagess)
                  _this.ticebaogao1 = _this.imagess[0]
                  console.log(_this.avatar)
                  img = img + JSON.parse(res.data).url + ';'
                  _this.imgurl = img
                }
              });
            }
          }
        });
      },
      chooseImage1() {
        var _this = this
        uni.chooseImage({
          count: 1, //默认9
          sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
          sourceType: ['album'], //从相册选择
          success: function(res) {
            let file = res.tempFilePaths
            var images = []
            var img = ''
            console.log(res.tempFilePaths[0])
            _this.frontPhoto = res.tempFilePaths[0]
            for (var i = 0; i < res.tempFilePaths.length; i++) {
              uni.uploadFile({
                url: 'https://jxjsservice.jxfit.cn/coach/baseService/uploadFile',
                //仅为示例，非真实的接口地址
                filePath: file[i],
                name: 'file',
                formData: {
                  'user': 'test'
                },
                success: (res) => {
                  console.log(res)
                  console.log(JSON.parse(res.data))
                  images.push(JSON.parse(res.data).datas.face)
                  _this.imagess = images
                  // console.log(_this.imagess)
                  _this.frontPhoto1 = _this.imagess[0]
                  console.log(_this.frontPhoto1)
                  img = img + JSON.parse(res.data).url + ';'
                  _this.imgurl = img
                }
              });
            }
          }
        });
      },
      chooseImage2() {
        var _this = this
        uni.chooseImage({
          count: 1, //默认9
          sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
          sourceType: ['album'], //从相册选择
          success: function(res) {
            let file = res.tempFilePaths
            var images = []
            var img = ''
            console.log(res.tempFilePaths[0])
            _this.backPhoto = res.tempFilePaths[0]
            for (var i = 0; i < res.tempFilePaths.length; i++) {
              uni.uploadFile({
                url: 'https://jxjsservice.jxfit.cn/coach/baseService/uploadFile',
                //仅为示例，非真实的接口地址
                filePath: file[i],
                name: 'file',
                formData: {
                  'user': 'test'
                },
                success: (res) => {
                  console.log(res)
                  console.log(JSON.parse(res.data))
                  images.push(JSON.parse(res.data).datas.face)
                  _this.imagess = images
                  // console.log(_this.imagess)
                  _this.backPhoto1 = _this.imagess[0]

                  console.log(_this.avatar)
                  img = img + JSON.parse(res.data).url + ';'
                  _this.imgurl = img
                }
              });
            }
          }
        });
      },
      chooseImage3() {
        var _this = this
        uni.chooseImage({
          count: 1, //默认9
          sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
          sourceType: ['album'], //从相册选择
          success: function(res) {
            let file = res.tempFilePaths
            var images = []
            var img = ''
            console.log(res.tempFilePaths[0])
            _this.leftPhoto = res.tempFilePaths[0]
            for (var i = 0; i < res.tempFilePaths.length; i++) {
              uni.uploadFile({
                url: 'https://jxjsservice.jxfit.cn/coach/baseService/uploadFile',
                //仅为示例，非真实的接口地址
                filePath: file[i],
                name: 'file',
                formData: {
                  'user': 'test'
                },
                success: (res) => {
                  console.log(res)
                  console.log(JSON.parse(res.data))
                  images.push(JSON.parse(res.data).datas.face)
                  _this.imagess = images
                  // console.log(_this.imagess)
                  _this.leftPhoto1 = _this.imagess[0]
                  console.log(_this.avatar)
                  img = img + JSON.parse(res.data).url + ';'
                  _this.imgurl = img
                }
              });
            }
          }
        });
      },
      chooseImage4() {
        var _this = this
        uni.chooseImage({
          count: 1, //默认9
          sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
          sourceType: ['album'], //从相册选择
          success: function(res) {
            let file = res.tempFilePaths
            var images = []
            var img = ''
            console.log(res.tempFilePaths[0])
            _this.rightPhoto = res.tempFilePaths[0]
            for (var i = 0; i < res.tempFilePaths.length; i++) {
              uni.uploadFile({
                url: 'https://jxjsservice.jxfit.cn/coach/baseService/uploadFile',
                //仅为示例，非真实的接口地址
                filePath: file[i],
                name: 'file',
                formData: {
                  'user': 'test'
                },
                success: (res) => {
                  console.log(res)
                  console.log(JSON.parse(res.data))
                  images.push(JSON.parse(res.data).datas.face)
                  _this.imagess = images
                  // console.log(_this.imagess)
                  _this.rightPhoto1 = _this.imagess[0]
                  console.log(_this.avatar)
                  img = img + JSON.parse(res.data).url + ';'
                  _this.imgurl = img
                }
              });
            }
          }
        });
      },
      bindDateChange: function(e) {
        console.log('picker发送选择改变，携带值为', e.target.value)
        this.date = e.detail.value
        this.setajax()
      },
      menusClick(index) {
        console.log(index)
        this.currentIndex = index
      },
      xiayibu() {
        this.currentIndex = 1
      },
      back() {
        console.log(1)
        uni.navigateTo({
          url: './Physical_test_list',
        });
      },
    }
  }
</script>

<style>
  .st_class {
    color: #919191;
    font-size: 38upx;
    width: 200upx;
  }

  .active {
    color: #000;
  }
</style>
